<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>jq</title>
</head>
<style>
	
</style>
<script src="jquery.js"></script>

<body>

	<h1>aaaaaaaaaaaaa</h1>
	<h1>aaaaaaaaaaaaa</h1>
	<h1>aaaaaaaaaaaaa</h1>
	<h1>aaaaaaaaaaaaa</h1>
	<h1>aaaaaaaaaaaaa</h1>

</body>
<script>
	//each循环,给h1复制num
	$('h1').each(function(i){ //each函数本身可以传参数i;打印i; 把5个h1变成jquery对象，把里面的每个h1进行遍历输出。
		//alert(i);

		$('h1').get()[i].setAttribute('num',i+1); //将jq对象转换成js对象数组,设置属性num；
		//$('h1').get()为数组
	});

	$('h1').click(function(){
		this.innerHTML=this.getAttribute('num');
	});

	
</script>
</html>